<?php

namespace App\Console\Commands;

use App\Admin\Models\Statistic;
use Illuminate\Console\Command;

class GetLoginToken extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'getLoginToken {--uid=}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '获取token';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $uid = $this->option('uid');
        $user = \App\Modules\User\Models\User::find($uid);
        $token = \JWTAuth::fromUser($user);
        echo $token."\r\n";

    }
}
